<template>
  <commonCard :titleArr="titleArr" :currnetId="currnetId" @setId="setId">
    <edit-course v-if="currnetId == 1" :dateilData='dateilData'></edit-course>
    <design-course v-else-if="currnetId == 2" :emitID='emitID' :courseTypeBf='courseTypeBf'></design-course>
  </commonCard>
</template>
<script>
import Bus from "@/utils/bus";
import designCourse from "@/components/course/designCourse.vue";
import commonCard from "@/components/common/commonCard.vue";
import editCourse from "@/components/course/editCourse.vue";
export default {
  components: {
    editCourse,
    commonCard,
    designCourse,
  },
  data() {
    return {
      currnetId: 1,
      titleArr: [
        {
          id: 1,
          name: "课程基本信息",
        },
        {
          id: 2,
          name: "课程设计",
        },
      ],
      dateilData:null,
      emitID:null,
      courseTypeBf:null
    };
  },
  created() {
    if(JSON.stringify(this.$route.params) !== "{}"){
      this.dateilData=this.$route.params
      Bus.$emit('setdata',this.$route.params)
    }
    Bus.$on("nextStepConrse", (val) => {
      this.currnetId =this.currnetId ==1?2:1;
      this.emitID=val.id
      this.courseTypeBf=val.courseType
    });
  },
  methods: {
    setId(i) {
      this.currnetId = i;
    },
  },
};
</script>